package com.dk.test;

import com.dk.task.MyThread02;

/**
 * 测试线程优先级
 */
public class Demo02 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new MyThread02());
        Thread t2 = new Thread(new MyThread02());

        t1.setName("线程1");
        t2.setName("线程2");

        // getPriority() 获取线程优先级
        // setPriority() 设置线程优先级1-10 默认5
        t1.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.NORM_PRIORITY);

        t1.start();
        t2.start();
    }
}
